package inference;

import java.util.Iterator;
import java.util.Random;

import com.aliasi.cluster.LatentDirichletAllocation;
import com.aliasi.cluster.LatentDirichletAllocation.GibbsSample;

public class LdaRunnable implements Runnable{
	LatentDirichletAllocation mLda;
	LatentDirichletAllocation.GibbsSample sample;
	final int [][] mDocTokens;
	final Random mRandom;
	final short numTopics;
	final double alpha;
	final double beta;
	final int numSamples;
	
	LdaRunnable(int [][] docTokens, long seed, int topics, double topicPrior, double wordPrior, int samples){
		mDocTokens = docTokens;
		mRandom = new Random(seed);
		numTopics = (short)topics;
		alpha = topicPrior;
		beta = wordPrior;
		numSamples = samples;
	}
	
	public void run(){
		Iterator<GibbsSample> it = LatentDirichletAllocation.gibbsSample(mDocTokens, numTopics, alpha, beta, mRandom);
		for(int i=1; i<numSamples; i++)
			it.next();
		
		sample = it.next();
		
		mLda = sample.lda();
		
		
		
	}

}
